package de.baumann.browser.utils

import android.annotation.SuppressLint
import android.os.CountDownTimer
import android.widget.TextView
import de.baumann.browser.R

class CountTimer2(
        var textView: TextView,
        var endStr: String,
        millisInFuture: Long = 60000,
        countDownInterval: Long = 1000
) : CountDownTimer(millisInFuture, countDownInterval) {

    override fun onFinish() {
        textView.isClickable = true
        textView.text = endStr
        textView.setBackgroundResource(R.drawable.shape_bg_yellow)
    }

    @SuppressLint("SetTextI18n")
    override fun onTick(millisUntilFinished: Long) {
        textView.isClickable = false
        textView.text = "分享领红包${millisUntilFinished / 1000}"
    }

}